// base64转换临时地址
export const base64ToTempFilePath = (base64Data) => {
    const fs = uni.getFileSystemManager();
    const fileName = "takes_photo_time" + Date.now() + ".png";
    const filePath = uni.env.USER_DATA_PATH + "/" + fileName;
    const base64 = base64Data.split(",")[1]; //移除固定头部data:image/png;base64,
    const buffer = uni.base64ToArrayBuffer(base64);
    return new Promise((resolve) => {
      fs.writeFile({
        filePath,
        data: buffer,
        encoding: "binary",
        success() {
          resolve(filePath);
        },
      });
    });
  };
